package cn.edu.dgut.xhx.covid.config;

import cn.edu.dgut.xhx.covid.service.CovidService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class CovidDataScheduled {

    @Autowired
    private CovidService covidService;

    /**
     * 每小时获取一次
     */
    @Scheduled(cron = "0 0 0/1 * * ?")
    private void getCovidData() throws IOException {
        covidService.updateData();
    }
}
